#include <stdio.h>
int main(void)
{
    int hh, mm;
    char ap;
    printf("Enter a 12-hour time: ");
    scanf("%d:%d %c", &hh, &mm, &ap);
    if (ap == 'p' || ap == 'P')
        hh = hh % 12 + 12;
    printf("Equivalent 24-hour time: %d:%d\n", hh, mm);
    return 0;
}